home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 76 / XENIATGM66.iso / Indiana Jones / Indiana Jones.exe / RESOURCE / PREVIEW.GOB / cog_sol_chaseblowit.cog < prev    next >
Text File  |  1999-11-15  |  14KB  |  482 lines

  1. # Jones 3D Cog Script
  2. #
  3. # SOL_ChaseBlowIt.cog
  4. #
  5. # waypoints by [SCHOLL]
  6. #
  7. # [TRM]
  8. #
  9. # (C) 1999 LucasArts Entertainment Co. All Rights Reserved
  10. # ========================================================================================
  11.  
  12. symbols
  13.  
  14.     message     startup
  15.     message     user0
  16.     message     user1
  17.     message     entered
  18.     message     removed
  19.     message     pulse
  20.     
  21.     thing       player      local
  22.     thing       car         local
  23.     thing       tnt1        local
  24.     thing       tnt2        local
  25.     thing       grenade     local
  26.     
  27.     thing       comCar_Upper
  28.     thing       comCar_Lower
  29.     
  30.     thing       comCar_Start1
  31.     thing       comCar_Start2
  32.     thing       comCar_Start3
  33.     
  34.     thing       cam1
  35.     thing       camTarg1
  36.     thing       commTarg1
  37.     
  38.     thing       exp1
  39.     thing       exp2
  40.     thing       exp3
  41.     
  42.     thing       com1        # tnt commies
  43.     thing       com2
  44.     
  45.     thing       ghostTnt1
  46.     thing       ghostTnt2
  47.     
  48.     # ** oil shed commies **
  49.     thing       os_com3
  50.     thing       os_com4
  51.     thing       os_com_grenade
  52.     
  53.     # ** oil shed items
  54.     thing       os_Satchels
  55.     thing       os_Grenades
  56.     thing       os_Health
  57.     
  58.     surface     readySurf       mask=0x404      
  59.     surface     blowItSurf      mask=0x404      # trigger explosions
  60.     surface     stopSurf        mask=0x004      # destroy comCar
  61.     surface     front
  62.     surface     back
  63.     
  64.     template    tplExp=+dummy_bazooka           local
  65.     template    tplTnt=tntcrate                 local
  66.     template    grenade_tpl=+grenade            local
  67.     
  68.     sound       comWatch=Inxh1012.wav           local   # watch out!
  69.         
  70.     keyframe    comReach=1h_reach_low.key       local
  71.     keyframe    im_Duck=im_duckdown.key         local
  72.     keyframe    im_GetUp=im_getup.key           local
  73.     
  74.     # ** types **
  75.     AI            ai_sniper=com_1HGrndSniper.ai    local
  76.     
  77.     # ** cogs **
  78.     cog         transformer
  79.     cog         chaseUpper
  80.     cog         chaseLower
  81.     cog         hintCog
  82.     cog         ambush
  83.     
  84.     int         ready=0         local
  85.     int         blowIt=0        local
  86.     int         done=0          local
  87.     int         pulseCount=0    local
  88.     int         upper=0         local
  89.     int         duck_Track      local
  90.     int         chase_Ready=0   local
  91.     
  92. # ===========================WAYPOINTS================================================
  93.     int            n_idx                local
  94.     int            WAYPOINT_BASE=25        local
  95.     int            NUM_WAYPOINTS=6            local
  96.     thing        t_Waypoint00
  97.     thing        t_Waypoint01
  98.     thing        t_Waypoint02
  99.     thing        t_Waypoint03
  100.     thing        t_Waypoint04
  101.     thing        t_Waypoint05
  102.     
  103.     # ** subroutines **
  104.     flex        tossgrenade             local
  105.     flex        activatewaypoints        local
  106.     flex        blowItCut               local
  107.     
  108. end
  109.  
  110. # ========================================================================================
  111.  
  112. code
  113.  
  114. startup:
  115.  
  116.     # hide commies
  117.     SetThingFlags(com1, 0x80000);
  118.     SetThingFlags(com2, 0x80000);
  119.  
  120.     # disable bi-ped commies
  121.     AISetCutsceneMode(com1);
  122.     AISetCutsceneMode(com2);
  123.     
  124.     # hide oil shed commies
  125.     SetThingFlags(os_Com3, 0x80000);
  126.     SetThingFlags(os_Com4, 0x80000);
  127.     SetThingFlags(os_com_grenade, 0x80000);
  128.     
  129.     # hide oil shed inventory items
  130.     SetThingFlags(os_Health, 0x80000);
  131.     SetThingFlags(os_Grenades, 0x80000);
  132.     SetThingFlags(os_Satchels, 0x80000);
  133.  
  134.     return;
  135.     
  136. # ========================================================================================
  137.  
  138. user0:
  139.  
  140.     upper = 1;
  141.     return;
  142.  
  143. # ========================================================================================
  144.  
  145. user1:
  146.  
  147.     chase_Ready = 1;
  148.     return;
  149.  
  150. # ========================================================================================
  151.  
  152. entered:
  153.         
  154.     player = GetLocalPlayerThing();
  155.     car = GetSourceRef();
  156.     
  157.     if((BitTest(GetPhysicsFlags(car), 0x01000000)) && (done == 0) && (chase_Ready == 1))
  158.     {
  159.         # start cutscene
  160.         if(GetSenderRef() == readySurf)
  161.         {
  162.             if((GetSourceRef() == comCar_Upper) || (GetSourceRef() == comCar_Lower))
  163.             {
  164.                 #Print("comCar entered readySurf");
  165.                 ready = 1;
  166.                 
  167.                 # start countdown
  168.                 SetPulse(1.0);
  169.                 
  170.                 if(upper == 1)
  171.                 {
  172.                     SetThingThrust(comCar_Upper, '0.0 2.0 0.0');
  173.                 }
  174.                 
  175.                 else
  176.                 {
  177.                     SetThingThrust(comCar_Lower, '0.0 2.0 0.0');
  178.                 }
  179.             }
  180.             
  181.             # player reached readySurf before pulseCount is 3
  182.             else if((GetSourceRef() == player) && (ready == 1))
  183.             {
  184.                 #Print("player entered readySurf ON TIME");
  185.                 blowIt = 1;
  186.                 
  187.                 Call blowItCut;
  188.             }
  189.             
  190.             # player didn't reach readySurf in time
  191.             else if((GetSourceRef() == player) && (ready == 0))
  192.             {
  193.                 #Print("player entered readySurf LATE");
  194.                 
  195.                 blowIt = 1;
  196.                 # comCar came from chaseUpper
  197.                 if(upper == 1)
  198.                 {
  199.                     #Print("teleporting comCar_Upper to comCar_Start3");
  200.                     StopThing(comCar_Upper);
  201.                     ClearThingFlags(comCar_Upper, 0x80000);
  202.                     TeleportThing(comCar_Upper, comCar_Start3);
  203.                     StopAllSoundsThing(comCar_Upper);
  204.                     Call blowItCut;
  205.                     #upper = 0;
  206.                 }
  207.                 
  208.                 # comCar came from chaseLower
  209.                 else
  210.                 {
  211.                     #Print("teleporting comCar_Lower to comCar_Start3");
  212.                     StopThing(comCar_Lower);
  213.                     Sleep(0.1);
  214.                     ClearThingFlags(comCar_Lower, 0x80000);
  215.                     TeleportThing(comCar_Lower, comCar_Start3);
  216.                     StopAllSoundsThing(comCar_Lower);
  217.                     Call blowItCut;
  218.                 }
  219.             }
  220.         }
  221.         
  222.         # blow it up
  223.         else if((GetSenderRef() == blowItSurf) && (blowIt == 1))
  224.         {
  225.             # comCar enters blowItSurf
  226.             if((GetSourceRef() == comCar_Upper) || (GetSourceRef() == comCar_Lower))
  227.             {
  228.                 #Print("comCar entered blowItSurf");
  229.                 
  230.                 # start player moving again
  231.                 SetThingThrust(player, '0.0 1.25 0.0');
  232.                 
  233.                 # toss a grenade from comCar
  234.                 Call tossgrenade;
  235.                 
  236.                 # panic say line for biped commies when they see the grenade!
  237.                 PlayVoice(com2, comWatch, 1.0, 0);
  238.                 
  239.                 Sleep(0.5);
  240.                 
  241.                 # send biped commies fleeing from grenade
  242.                 AISetMoveSpeed(com1, 4.5);
  243.                 AISetLookThing(com1, commTarg1);
  244.                 AISetMoveThing(com1, commTarg1, 0);
  245.                 Sleep(0.25);
  246.                 AISetMoveSpeed(com2, 4.5);
  247.                 AISetLookThing(com2, commTarg1);
  248.                 AISetMoveThing(com2, commTarg1, 0);
  249.                 
  250.                 # give biped commies time to get away
  251.                 Sleep(2.0);
  252.             }
  253.             
  254.             # player enters blowItSurf so make him stop here
  255.             else if(GetSourceRef() == player)
  256.             {
  257.                 #Print("player entered blowItSurf");
  258.                 
  259.                 # stop player
  260.                 StopThing(player);
  261.                 Sleep(1.0);
  262.                 
  263.                 # restore camera and controls
  264.                 SetCurrentCamera(1);
  265.                 ClearActorFlags(player, 0x200000);
  266.                 
  267.                 # enable bi-ped commies
  268.                 AIClearCutsceneMode(com1);
  269.                 AIClearCutsceneMode(com2);
  270.                 
  271.                 ClearActorFlags(player, 0x200000);
  272.                 EndCutscene();
  273.                 
  274.                 Call ActivateWaypoints;
  275.                 done = 1;
  276.                 
  277.                 if(upper == 1) DestroyThing(comCar_Upper);
  278.                 else DestroyThing(comCar_Lower);
  279.                 
  280.                 # tell ambush that secondLap = 1
  281.                 SendMessage(ambush, user0);
  282.                 
  283.                 # show oil shed commies
  284.                 ClearThingFlags(os_com3, 0x80000);
  285.                 ClearThingFlags(os_com4, 0x80000);
  286.                 ClearThingFlags(os_com_grenade, 0x80000);
  287.                 
  288.                 # show oil shed inventory items
  289.                 ClearThingFlags(os_Health, 0x80000);
  290.                 ClearThingFlags(os_Grenades, 0x80000);
  291.                 ClearThingFlags(os_Satchels, 0x80000);
  292.                 
  293.                 # turn os_com_grenade into a sniper
  294.                 AISetClass(os_com_grenade, ai_sniper);
  295.             }
  296.         }
  297.            
  298.         # destroy comCar
  299.         else if(GetSenderRef() == stopSurf)
  300.         {
  301.             # comCar came from chaseUpper
  302.             if(upper == 1)
  303.             {
  304.                 #Print("comCar_Upper teleported");
  305.                 StopThing(comCar_Upper);
  306.                 #TeleportThing(comCar_Upper, comCar_Start1);
  307.                 #SetThingFlags(comCar_Upper, 0x80000);
  308.                 StopAllSoundsThing(comCar_Upper);
  309.                 #upper = 0;
  310.             }
  311.             
  312.             # comCar came from chaseLower
  313.             else
  314.             {
  315.                 #Print("comCar_Lower teleported");
  316.                 StopThing(comCar_Lower);
  317.                 #TeleportThing(comCar_Lower, comCar_Start2);
  318.                 #SetThingFlags(comCar_Lower, 0x80000);
  319.                 StopAllSoundsThing(comCar_Lower);
  320.             }
  321.         }
  322.     }
  323.         
  324.     return;
  325.  
  326. # ========================================================================================
  327.  
  328. blowItCut:
  329.  
  330.     # do cutscene stuff
  331.     StartCutscene(0);
  332.     SetActorFlags(player, 0x200000);
  333.     
  334.     # stop player outside mine doors
  335.     StopThing(player);
  336.     
  337.     # show TnT commies
  338.     ClearThingFlags(com1, 0x80000);
  339.     ClearThingFlags(com2, 0x80000);
  340.     
  341.     Sleep(0.1);
  342.     
  343.     # Cut to cam1 inside oil key room
  344.     SetCameraFocus(2, cam1);
  345.     SetCameraSecondaryFocus(2, camTarg1);
  346.     SetCurrentCamera(2);
  347.     SetCameraFOV(90, 0, 0.0);
  348.     
  349.     if(ready == 0)
  350.     {
  351.         if(upper == 1)
  352.         {
  353.             Sleep(0.1);
  354.             SetThingThrust(comCar_Upper, '0.0 1.0 0.0');
  355.         }
  356.         
  357.         else
  358.         {
  359.             Sleep(0.1);
  360.             SetThingThrust(comCar_Lower, '0.0 1.0 0.0');
  361.         }
  362.     }
  363.     
  364.     # commies put down the TnT
  365.     PlayKey(com1, comReach, 4, 0x12, 0);
  366.     Sleep(0.5);
  367.     tnt1 = CreateThing(tplTnt, ghostTnt1);
  368.     CaptureThing(tnt1);
  369.     PlayKey(com2, comReach, 4, 0x12, 0);
  370.     Sleep(0.5);
  371.     tnt2 = CreateThing(tplTnt, ghostTnt2);
  372.     CaptureThing(tnt2);
  373.                 
  374.     return;
  375.  
  376. # ========================================================================================
  377.  
  378. tossgrenade:
  379.  
  380.     # toss the grenade
  381.     if(upper == 1)
  382.     {
  383.         grenade = CreateThingAtPos(grenade_tpl, GetThingSector(comCar_Upper), GetThingPos(comCar_Upper), '0 0 0');
  384.     }
  385.     
  386.     else
  387.     {
  388.         grenade = CreateThingAtPos(grenade_tpl, GetThingSector(comCar_Lower), GetThingPos(comCar_Lower), '0 0 0');
  389.     }
  390.     
  391.     CaptureThing(grenade);
  392.     SetThingLight(grenade, '1.0 1.0 1.0', 0.01, 0.01);
  393.                     
  394.     return;
  395.  
  396. # ========================================================================================
  397.  
  398. removed:
  399.  
  400.     if(GetSenderRef() == grenade)
  401.     {
  402.         Sleep(0.5);
  403.         
  404.         #duck_Track = PlayKey(player, im_Duck, 4, 0x14, 0);
  405.         
  406.         # create explosions and destroy TnT
  407.         CreateThing(tplExp, exp1);
  408.         DestroyThing(tnt1);
  409.         Sleep(0.25);
  410.         CreateThing(tplExp, exp2);
  411.         DestroyThing(tnt2);
  412.         CreateThing(tplExp, exp3);
  413.         
  414.         # blow open storage room chain link fence
  415.         SetFaceGeoMode(front, 0);       # no draw
  416.         SetFaceGeoMode(back, 0);
  417.         ClearAdjoinFlags(front, 0x10);       # player move
  418.         ClearAdjoinFlags(back, 0x10);
  419.         
  420.         # alter transformer zap so it hits the track now
  421.         SendMessage(transformer, user0);
  422.         
  423.         # tell chaseUpper and Lower that it blew up
  424.         SendMessage(chaseUpper, user0);
  425.         SendMessage(chaseLower, user0);
  426.         
  427.         # tell hintCog that hint14 is solved
  428.         #SendMessage(hintCog, user0);
  429.         
  430.         #StopKey(player, duck_Track, 0.5);
  431.         #PlayKey(player, im_GetUp, 4, 0x14, 0);
  432.     }
  433.     
  434.     return;
  435.  
  436. # ========================================================================================
  437.  
  438. pulse:
  439.  
  440.     pulseCount = pulseCount+1;
  441.     #PrintInt(pulseCount);
  442.     
  443.     if(pulseCount == 3)
  444.     {
  445.         #Print("pulseCount = 3");
  446.         ready = 0;
  447.         #blowIt = 0;
  448.         SetPulse(0.0);
  449.         pulseCount = 0;
  450.     }
  451.     
  452.     return;
  453.  
  454. # ========================================================================================
  455.  
  456. ActivateWaypoints:
  457.  
  458.     for ( n_idx = 0; n_idx < NUM_WAYPOINTS; n_idx = n_idx + 1 )
  459.     {
  460.         AISetWpnt(t_Waypoint00[n_idx], n_idx + WAYPOINT_BASE);
  461.     }
  462.  
  463.     AIConnectWpnts(0 + WAYPOINT_BASE, 1 + WAYPOINT_BASE);
  464.     AIConnectWpnts(1 + WAYPOINT_BASE, 2 + WAYPOINT_BASE);
  465.     AIConnectWpnts(2 + WAYPOINT_BASE, 3 + WAYPOINT_BASE);
  466.     AIConnectWpnts(3 + WAYPOINT_BASE, 4 + WAYPOINT_BASE);
  467.     AIConnectWpnts(4 + WAYPOINT_BASE, 5 + WAYPOINT_BASE);
  468.  
  469.     AISetInstinctWpntMode(com1);
  470.     AISetInstinctWpntMode(com2);
  471.     AIEnableInstinct(com1, "roam", 1);
  472.     AIEnableInstinct(com2, "roam", 1);
  473.     AIWpntHuntTarget(com1, 1.5, 0.0);
  474.     AIWpntHuntTarget(com2, 1.5, 0.0);
  475.  
  476.     return;
  477.     
  478. # ========================================================================================
  479.  
  480. end
  481.  
  482.